Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sketch of datatree.inherit method #9065

Closed

Conversation

TomNicholas
Copy link
Member

@TomNicholas TomNicholas commented Jun 4, 2024

(This is just pseudocode that I'm showing to compare against #9063)

@TomNicholas TomNicholas added the topic-DataTree Related to the implementation of a DataTree class label Jun 4, 2024
Comment on lines +990 to +995
return merge_core(
[existing_variables, candidate_variables],
priority_arg=1,
explicit_coords=list(candidate_variables.keys())
combine_attrs="override",
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should just be align like in #9056

# TODO should we be keeping track of which variables were coordinates?
all_inherited_variables.update(**inheritable_variables)

return DataTree.copy().update(all_inherited_variables)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is one possibility - this provides the user with a way to access inherited variables without enforcing that constraint on all trees.

@TomNicholas
Copy link
Member Author

Closing as a WIP attempt to implement something we decided against in #9077 (i.e. we decided not to allow child nodes to have variables which don't align with parents).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic-DataTree Related to the implementation of a DataTree class
Projects
Development

Successfully merging this pull request may close these issues.

1 participant